package com.xxrl.shop.domain;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.io.Serializable;

/**
 * @author mis
 */
@Data
@NoArgsConstructor
@Document(collection = "user_rating")
public class UserRating implements Serializable {

    @MongoId
    private String id;

    @Field
    private Long userId;

    @Field
    private Long productId;

    @Field
    private Double rating;

    @Field
    private String timeStamp;

    @CreatedDate
    private Long createTime;

    @LastModifiedDate
    private Long lastModifiedTime;
    
    public UserRating(Long userId, Long productId, Double rating) {
        this.userId = userId;
        this.productId = productId;
        this.rating = rating;
    }
}
